#include <bits/stdc++.h>

using namespace std;

#define in read()

const int MAXN = 3e6+10;
const int mod = 998244353;
const int g = 3;

typedef long long ll;

int n,m,rev[MAXN];
ll F[MAXN],G[MAXN];

int read(){int x=0,sgn=1;char ch=getchar();for(;!isdigit(ch);ch=getchar())if(ch=='-')sgn=-1;for(;isdigit(ch);ch=getchar())x=(x<<1)+(x<<3)+(ch^48);return x*sgn;}

ll qp(ll x,int t){ll res=1;for(;t;t>>=1,x=x*x%mod)if(t&1)res=res*x%mod;return res;}

void change(ll *f,int len){
	for(int i = 1;i < len;i++) rev[i] = (rev[i>>1]>>1)|(i&1?len>>1:0);
	for(int i = 1;i < len;i++) if(i < rev[i]) swap(f[i],f[rev[i]]);
}

void NTT(ll *f,int len,int on){
	change(f,len);
	for(int h = 2;h <= len;h<<=1){
		ll wn = qp(g,(mod-1)/h);
		for(int i = 0;i < len;i+=h){
			ll gg = 1;
			for(int k = i;k < i + h/2;k++){
				ll u = f[k],v = f[k + h/2] * gg % mod; gg = gg * wn % mod;
				f[k] = (u + v) % mod,f[k + h/2] = (u-v + mod) % mod;
			}
		}
	}
	if(on == -1){reverse(f+1,f+len);ll inv=qp(len,mod-2);for(int i = 0;i < len;i++) f[i] = f[i] * inv % mod;}
}

int main (){
	n = in,m = in;for(int i = 0;i <= n;i++) F[i] = in;for(int i = 0;i <= m;i++) G[i] = in;n++;m++;int len;
	for(len=1;len<n*2||len<m*2;len<<=1); NTT(F,len,1);NTT(G,len,1);for(int i = 0;i < len;i++) F[i] = F[i] * G[i] % mod;NTT(F,len,-1);
	for(int i = 0;i < n+m-1;i++) printf("%lld%c",F[i]," \n"[i==n+m-2]);return 0;
}
